<?php
 
defined("_VALID_ACCESS") || die('Direct access forbidden');
 
class SCTV_MaintenanceDeploymentCommon extends ModuleCommon {
 
    public static function menu() {
    	$menus = array('__submenu__' => 2);
	   
	    if(Base_AclCommon::check_permission('Delivery Maintenance: Today'))
			$menus[__('Delivery Maintenance'). ': ' . __('Today')] = array('__function__'=>'today');
		
		if(Base_AclCommon::check_permission('Delivery Maintenance: Tomorrow'))
			$menus[__('Delivery Maintenance'). ': ' . __('Tomorrow')] = array('__function__'=>'tomorrow');  
	   
        return array(
        	__('SCTV') => array
        	(
        		'__submenu__' => 1, 
        		__('BẢO TRÌ') =>$menus        		
			));
    }
	public static function deployment_exists($maintenance, $date, $employee){
		$ret = DB::GetOne('SELECT id FROM sctv_maintenancedeployment_data_1 WHERE sctv_maintenancedeployment_data_1.active = 1 and f_maintenance = %d and f_date = %T and f_technical = %d', array($maintenance, $date, $employee));
		$ret = ($ret!==false && $ret!==null);
		return $ret;
	}
	public static function deployment_not_exists($maintenance, $date, $employee){
		return !SCTV_MaintenanceDeploymentCommon::deployment_exists($maintenance, $date, $employee);
	}
}
 
?>